{% load static %}
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}古董展示{% endblock %}</title>
    <link href="{% static 'admin/css/base.css' %}" rel="stylesheet">
    <link href="{% static 'admin/css/dashboard.css' %}" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
    <style>
        body {
            background-color: #f8f9fa;
            background-image: 
                linear-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255, 255, 255, 0.5) 1px, transparent 1px),
                linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
            background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
            background-position: -1px -1px, -1px -1px;
            font-family: "SimSun", "STSong", serif;
            padding: 2rem 0;
        }

        .container {
            background-color: rgba(255, 255, 255, 0.95);
            box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
            border-radius: 5px;
            padding: 2rem;
        }

        .antique-card {
            transition: transform 0.2s;
            background-color: rgba(255, 255, 255, 0.9);
            border: 1px solid #e9ecef;
        }

        .antique-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .card-img-container {
            height: 300px;
            overflow: hidden;
            background-color: #f8f9fa;
            border-bottom: 1px solid #e9ecef;
        }

        .card-img-container img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        .badge {
            font-weight: 500;
            font-family: "SimSun", "STSong", serif;
        }

        .row-cols-md-3 > * {
            flex: 0 0 33.333333%;
            max-width: 33.333333%;
        }

        .display-4 {
            font-family: "SimSun", "STSong", serif;
            font-weight: bold;
            color: #343a40;
        }

        .lead {
            font-family: "SimSun", "STSong", serif;
            color: #6c757d;
        }

        .card-title {
            font-family: "SimSun", "STSong", serif;
            font-weight: bold;
        }

        .antique-number {
            color: #6c757d;
            font-size: 0.9em;
            margin-left: 0.5em;
        }

        .btn-outline-primary {
            border-color: #343a40;
            color: #343a40;
        }

        .btn-outline-primary:hover {
            background-color: #343a40;
            color: white;
        }
    </style>
</head>
<body>
    <div class="container">
        {% block content %}
        {% endblock %}
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 创建图片查看器
            const imageViewer = document.createElement('div');
            imageViewer.className = 'image-viewer';
            imageViewer.style.cssText = `
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background: rgba(0, 0, 0, 0.8);
                display: none;
                justify-content: center;
                align-items: center;
                z-index: 1000;
                cursor: pointer;
            `;
            document.body.appendChild(imageViewer);

            // 创建图片容器
            const imageContainer = document.createElement('div');
            imageContainer.style.cssText = `
                max-width: 90%;
                max-height: 90%;
                position: relative;
            `;
            imageViewer.appendChild(imageContainer);

            // 创建图片元素
            const fullImage = document.createElement('img');
            fullImage.style.cssText = `
                max-width: 100%;
                max-height: 100%;
                object-fit: contain;
            `;
            imageContainer.appendChild(fullImage);

            // 只在详细页启用图片放大功能
            if (window.location.pathname.includes('/detail/')) {
                // 为所有带有 data-full-image 属性的图片添加点击事件
                document.querySelectorAll('img[data-full-image]').forEach(img => {
                    img.style.cursor = 'pointer';
                    img.addEventListener('click', function(e) {
                        e.preventDefault();
                        e.stopPropagation();
                        fullImage.src = this.dataset.fullImage;
                        imageViewer.style.display = 'flex';
                    });
                });
            }

            // 点击查看器关闭
            imageViewer.addEventListener('click', function() {
                this.style.display = 'none';
            });
        });
    </script>
    <div class="text-center mt-4">
        <a href="/admin/" target="_blank" class="text-muted">管理页面</a>
    </div>
</body>
</html>
